package com.jifeng.sterilizer.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.jifeng.sterilizer.entity.LiquidTypeEntity;
import com.jifeng.sterilizer.service.LiquidTypeService;
import com.jifeng.sterilizer.utils.PageUtils;
import com.jifeng.sterilizer.utils.R;



/**
 * 药剂类型表
 *
 * @author jifeng
 * @email 1593140625@qq.com
 * @date 2020-07-26 15:15:15
 */
@RestController
@RequestMapping("sterilizer/liquidtype")
public class LiquidTypeController {
    @Autowired
    private LiquidTypeService liquidTypeService;

    /**
     * 根据名称模糊查询
     */
    @GetMapping("/pc/name/list")
    public R getInfoByName(@RequestParam("id") Map<String, Object> params){
        R rs = liquidTypeService.getInfoByName(params);

        return rs;
    }

    /**
     * 模糊插叙药剂类型 PC
     */
    @GetMapping("/pc/drug/type/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = liquidTypeService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @GetMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
		LiquidTypeEntity liquidType = liquidTypeService.getById(id);

        return R.ok().put("liquidType", liquidType);
    }

    /**
     * 新增药剂类型 PC
     */
    @PostMapping("/pc/drug/type/add")
    public R save(@RequestBody LiquidTypeEntity liquidType){
		liquidTypeService.save(liquidType);

        return R.ok();
    }

    /**
     * 修改药剂类型 PC
     */
    @PostMapping("/pc/drug/type/update")
    public R update(@RequestBody LiquidTypeEntity liquidType){
		liquidTypeService.updateById(liquidType);

        return R.ok();
    }

    /**
     * 逻辑删除 PC
     */
    @PostMapping("/pc/drug/type/del")
    public R delete(@RequestBody Map<String, Object> params){
		R rs=liquidTypeService.del(params);
		return rs;
    }

}
